<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue中多个元素过渡</title>  
    <script src="./vue.js"></script>
    <style>
        .v-enter,.v-leave-to{
            opacity: 0;
        }
        .v-enter-active,.v-leave-active{
            transition: opacity 1s;
        }
    </style>
</head>
<body>
    <div id="root">
        <transition mode='out-in'>
            <div v-if='show' key='hello'>Hello World!</div>
            <div v-else key='bye'>Bye World!</div>
        </transition>
        <button @click=handleBtnClick>切换</button>
    </div>
    <script>

        var vm = new Vue({
            el:'#root',
            data:{
                show:true
            },
            methods:{
                handleBtnClick:function(){
                    this.show = !this.show
                }
            }
        })
    </script>
</body>
</html>